Fix the remove function

Finally fix the remove function. The case of the last node causes an
IndexError since it accesses an empty list, the feature of the Nil list
at the end.