fixed bugs in stepper code.