fixed upload and key generation