set_logic bug fix