fix ping function