Fix FilesResource
Add tests