fixed delete function

added pathname for correct recursion