HIBSPA-95 Fixes bugs introduced when refactoring relate functions.