fixed apply_a and set_up_system