correct the parser, add exception handling