fixed canvas _on_realize bug