added a tryWrite function