fix readpagefromfile bugs