Fixed a few bugs, added a test for linked list.