Apply fixes to BFS 406 scheduler

As stated in an earlier commit, I had to manually apply most of the BFS patch. Couple minor edits for a cleaner compilation.