need to insert `buffer(writeIdx) = null` here