fixed problem with 0 and 1 elements in the list