save the previous drawing and fix clear bug