error recovery (thx @colorwind)