Fixed (I think) divide by zero bug