move some bsim-specific code inside #ifdef