Improve error status handling