fixed bugs that causes pages to rendor incorrectly