fixed bug on keeponlypages tweak

did a code update to fix code errors