step logic fix for divide by zero