I forgot to add the picture of the screen when the bug happens.
This is the screenshot of step 5
[image: 1629056268496-core2bug1-resized.jpg]
it seems like a part of M5Img (in a rectangle (35,132, 274,16) is written back onto the text.
and this is the screenshot of the code above (right after calling lcd.rect(...) )
[image: 1629056381759-core2bug2-resized.jpg]
and the rectangle (35,132,274,16) is overwritten with the background.
when you use M5Img instead of screen.set_screen_bg_color, you will see a part of the image instead of the background.
in both screenshots, text must be shown without a black/yellow rectangle.