My canvas Undo button does not work proper

Hi, My canvas Undo button does not work proper. the problem is that after I draw lines in different colors , when I push Undo button whole colored lines convert to last color one and then applied undo command. could you please help me?
Paint_copy.aia (450.3 KB)

Have you been following this guide ?
https://groups.google.com/g/app-inventor-developers-library/c/yF2Auslt82M/m/e-9D1gSIS78J