Starting writing section encoder
Fixes bug in direct flags decoding