add protection against division by zero