copy keys as well as values when store by value is enabled

Unfortunately jsr107 wants us to copy both keys and values when STORE_BY_VALUE is enabled.