Fix division by zero exception (Closes #5)