fixed a bug in cloud code