Build fix for post PM/scheduler Haiku, some more.

* I actually don't remember what those other changes were about, but they
  seem to add missing functionality. Also, the previous version did not
  even compile.
* There is still some debug output left in the new code.