Improve/fix error reporting