This is such a simple one. Please i implore you to implement the fix i have suggested. My only argument right now is that the fix suggested i describe comes from how your Unix releases implement this issue. They provide PATH_TRANSLATED, and they dont shift the case.
