bug fix, and skip some redundant checks