Updated set_bcs function