altered hist to return earlier if no key present