Fix Javascript errors in Phonegap (see #777)
Merge pull request #778 from Skyr/master

Fix for Javascript errors in Phonegap