fix db manager bugs