remove redundant loop