fixing ping function, which during tests was not returning properly