Fix upload of keys, closes #581