Fixed errorhandling in upload