Fix GUI crash, items with outputs now take priority in factories and electric machines