fixing a bug with error codes (part 2/2)