fixed division by zero bug