Fixed bug in errormapping
Made error mapping work correctly in interactive mode as well as in batch mode