check key is non-null before use