Fixed crash when removing widget in a specific situation