fix stack overflow caused by Canvas widget