Fixed bugs preventing upload
Fixed bug in tests.