added test of bboptimize and fixed some bugs in it