fixed a bug in series expansion