Fixed infinite loop in device graph processing