Fix nil check in Ping method