really fixed error handling