Updating the db connection and fixing the errors in percent count