Bug fixes to cloud API and more tests