Import patch to bugfix from Padrino Helpers

Padrino had an issue https://github.com/padrino/padrino-framework/issues/1582
which was solved at https://github.com/padrino/padrino-framework/commit/72769fe39a2f6368a474e05102cb7c35c5fdc685#diff-526024418d0d573e08d46ba3d55c02bcR36

This commit brings the same fix back into Middleman's method that overrides Padrino's method,
since I had a similar issue when using Middleman.

On a side note: should PR be against the `v3-stable` branch? Or would you like two separate PRs, one against `v3-stable`, one against `master`? Thanks!