This was alredy fixed in #755 but had to be reverted. This PR should be more intelligent about deciding which path to use.