changed way to detect missing key since None is already a possible value

Please check before applying