Fix bug with key not being saved