Found bug in do_bgfg. Fixes #16.