fix canvas.restore bugs