Fix for #2925 and #4290

Fix for #2925 and #4290 (Twig does not properly support null attribute and relationship values)