upgrade code to 3.x