fix tail and head functions

add another test case for adding nodes and counting them