added case if node to be deleted is head