fix error type check