fix for edge bug when removing last item from a list