added db connection check