fix cloud function