Fixed threading in tests
inlined empty check