fixed a canvas refresh bug