improve mag_set_ui / mag_set_ui_lower and add test code