sync with BTAS/BTAS after Toru's fixes for compiling BAGEL