fix error code at the wrong place