Improved / fixed error reporting