Fixed potential division by zero error