Fix of the flood fill algorithm