moved error reporting