improve error recovery