Support for empty indexes, missing dir
Fixed file permissions
Support for empty indexes