refactor model reference access
fix commented test case
fix recursion into nullable foreign models