fix for: removing last item fails