minor improvement for error detection