tweak error
allow_keys support + related refactoring
unit test + fix to functionality for allow_keys