fixed the delete funcion