fixed db connection error bug