Fix struct types, UI_DEV values, and output code