Added check for empty commands.