save/restore ctx when rendering board