fixed problem with saving keys