added more precise error reporting