fixing ping logic