handled potential divisions by zero