fix race condition
fix race condition due to simultaneous reading (sending) and modification (within matrix_elements()) of same matrix elements
fix race condition due to simultaneous reading (sending) and modification (within matrix_elements()) of same matrix elements