Minor updates to handle undefined/null value when flushing