Bug fix for upload