Fixed bfs's failure case, empty submatches print and initialization.