added better error handling for uploads