[solution to 4.3] Fix nth to handle the end of a list