fix bug that sometimes led to data being lost and EBUSY