Hopefully fixed segfault issue in writeBinary().