fixed to run in firefox mobile and as cordova app