Writing OCFs. Encoding bugfixes.