Added exceptions to catch null keys