fixed various output ordering issue