Fixed a bug in AlgebraicFraction._simplify which is used in __init__.