Fix some bugs in decoder

* Fix a possible nil crash
* A multiline session file is now supported