Fix identation issues
Calculate path component count in a different way to avoid problems with special characters.