Fixed is in range function