fix error code bug