Fix the bug that return nil value in scan return and modified calculation for measuring the distance of rows and columns in find_marks_grid