Fixed bugs when handling incoming commands that didn't exacly fit
the assumptions.