Fixed p2g in accordance with Sage v6.1.1