fix NPE; tolerate flexible data filed
fix logging