avoids NPE with empty reference fields
more robust type casting with forms
enable to build relations on empty loaded_associations; should be extracted in a method