fixed division by zero error when removing element from empty list