Fixed scoping bug. Fixed order of recovery for complex relationships