Corrected syntax to check existence of hash key beofre dereferencing it