Document upload bugfix