Fixed old hidden bug on key pattern matching