added some error checking, fixed a PING/PONG crash bug