Fix bug when accessing canvas inside an iframe