Fix nested db usage