Added a fix for incorrect behaviour ocurring when boost::function<> instances are shared across shared module boundaries.