Fixed orderBy to use relation query