Fixed broken delete function