Avoid NaN

Add empty check to avoid NaN. It happened when no data is coming yet or the target field does not exist. See the test.