fix for chrome ("Uncaught Error: NotFoundError: DOM Exception 8")

Uncaught Error: NotFoundError: DOM Exception 8
Merge pull request #177 from flymke/master

fix for chrome ("Uncaught Error: NotFoundError: DOM Exception 8")