trying to sort write errors