fix page number smaller than 0 issue