Avoid showing javascript warning when canvas is refreshing