Added debug logging + fixed processing null values