merged changes from https://github.com/phonegap-build