Fix #1028

Normalize paths aggressively so they are always reasonable (Issue #1028)