fixed bugs for different length five and three ranges