Fixed the deleting bug