fix error check issue