Fix bug with relationships when adding a file.

Relationships were not being created properly.