Change write to end