fix bugs about page manipulate in python and c code