Made code a little more robust to picloud errors