Added ping, fixed some bugs.