Fixed a few bugs with upload.