Fix wrong model being used for relations