fixed some writing issues