guarded against divide by zero error