fixed broken delete function