added error handling for non-phonegap use..