fixing pages pre/after methods bug