Fixes #2713: using relations defined in behavior may throw exception in lazy loading.