Some exception fixes

1. fixed exception when get snippets if some fields is None
2. UnicodeEncodeError on Windows