added an if-connected check for unrecognized client commands