Fixed file/direcotory handling