a better version of the DOM Exception fix that actually fixes the syntax instead of hacking around