fixed the command variable and added some debugging