added the possibility of asynchronous write