improved error reporting for syntax errors