Fixed boost 1.53 issues

Replaced boost::shared_dynamic_cast with boost::dynamic_pointer_cast