Use max() to prevent division by zero Closes #5696