Fixes for use DataTable within loop

we're using DataTable within non-trivial loop and there are was few race conditions.