Improve BOF handling