fixing error generation