bfs: minor refactoring of hrev48308

- also additional error checks added, as suggested
  by Axel Dörfler