Fixed bugs with dynamic objects