solved by changing head node's next from nullNode to null