add try and catch if tempObject has been deleted already