Removed a delete call that shouldn't be around and fixed a warning by casting an object to a list.