fixed segfault issue cause by incorrect step value calculation used in the original code - causing a smaller than required step value