fix divided by zero bug