The structKeyExists() checks don't work correctly with full null support. Change to isNull() checks instead.