Fixed file exists logic