Fixed infinite loop in division bug