fixed parsing issue, improved error messages