misc fixes to support writing