Fix issue with detecting the backend on windows, as a result of quirk in dirname(). Fixes #468.