moved execute_cmd before using it