fix bug that was killing javascript when canvas element not fount