fixing bug in the deletion script