fixed bug where delete function wasn't deleting everything