fix query test case; add RNG initialization; fix open empty DB