working code without saved input on error