Using pageindex and writing to correct location in FrameBuffer