Fix timing issue when building DB from scratch