length comparison added to avoid substring of key beingfoung
test added for the substring keys