fix bug for range