Fixing delete function