Error reporting

Moved the error reporting