Fixed endless loop in flood fill