Fixed bug in uploading and added more debugging.
Merge branch 'test' into dev