add last_key setting
add config support