Fixing empty DOM error

Checking to ensure element exists before trying to append, otherwise
DOM throws an error.
Merge pull request #1 from zmonteca/master

Fixing empty DOM error