Fixed assertion bug when removing a widget from an object