fix db connection null pointer bug