Fixed writing problems