port to phonegap 2.4+