fix error on saving codes