add protection for decoder and data format
Merge pull request #1382 from huili2/dataformat_bugfix

add protection for decoder and data format