Corrected the location to get the command code

Relocate "command" assignment prior to the internal/external
determination