add possibility to specify auto-generated keys.
add tests for auto-generated keys.