Fixed division by zero bug