Fix not writing posteriors correctly (redmine #1771)