Fix minor bugs in ping; add the most basic test.