added situations when the butterfly hits the edge