Bug fix for advanced relations