I cant really understand what the problem is but
one thing i can see is that you call put_row with wrong arguments
Code:
        put_row(c, step, stop);
shouldnt it be:

Code:
       put_row(c, stop, step);
??