Clean-up hash lookup and avoid local undef var
Merge pull request #841 from PierreR/patch-1

Clean-up hash lookup and avoid local undef var