fixed db join bug