Fixed some bugs, added another test