CommandInterpreter optimization and bug fix