Fix bi unittests writing outside sandbox

Fixes #420