Bug 984796: Fix some small errors in path flattening code. r=jwatt