Adding exception handling for Hash key error