Delete function being assigned correctly, not working correctly