Fixes #1794
This adds really a lot of code duplication for something that I'm not sure is worth it (cf my comment on #1794)
Ok i will close the PR.
Pull-Request has been closed by chocos
Fixes #1794