improving condition for the existance of PhoneGap.env