remove redundant checks in code