Trapped divide by zero

Previous commit coerced the nil/empty value to zero. This commit actually traps the division by zero.