add guard for division by zero