reintroduced workaround for Java FileChannel overwrite bug