Remove duplicated check logic and incorrect return type