some improvements in parser