Backporting various fixes from salt.cloud into salt-cloud