fixed a bug in range, num is accepted