fixed seg faults in reverseList() and freeList()