Google Analytics goal steps recorded as exit pages

We encountered a problem with the Google Analytics goal steps on one of our websites, where some of the steps were recorded as exit pages. In the following image, the first exit page is actually the second step in the goal:

Funnel visualization

After a bit of investigating, it seems that the first step matches all the subsequent ones, so proceeding to the next step in the goal is actually recorded as a page refresh, hence exit page. Our steps where:

1
2
/apartamente-finalizate-in-greenfield
/apartamente-finalizate-in-greenfield/cere-detalii

The solution in this case was to explicitly specify that the step URL matches the ending of the actual URL:

1
2
/apartamente-finalizate-in-greenfield$
/apartamente-finalizate-in-greenfield/cere-detalii$

Note that i encountered this problem with both head match and regular expression match on two different websites.