Fixed bug with clearing object