added check for master key in cloud code example. tweaked tests