making image relationships work in models