Added key check (closes #388)