fixed bug in range