sync with BTAS/BTAS after Naoki's rewrite