Paint "Undo" function not working

Hi! I’m trying to do bitmap undo function.
Like, I perform some operations with bitmapdata (puttin’ pixel there, filling with color);
I have those two functions. bmdCavas it tied to actual Bitmap with image, which is placed on screen.
last_step is BitmapData as well.

    function on_undo_btn (ev:MouseEvent)
    {
    bmdCanvas  = last_step.clone();    
    }
    function undo_save()
    {
    last_step  = bmdCanvas.clone();
    }

But this code is not working. Should I redraw image after changing itx bitmapdata or something?
or maybe I have to do undo function with bitmap itself?