fixed error top level error handling