Pull 2

Fixes a couple of issues with 3.1 that meant editing documents while uploading was not working.