fix an infinate loop case