Make series expansion work with non-rational functions. Patch by Alexei.