corrected dividing by zero error