make callback to handle errors if callbacks are defined
typo: remove duplicate calls to parse error