fix bugs in db subspacing