fixed several issues with parser implementation and added little test case