Fixes issue #868, by skipping missing related objects

Fixed if statement that broke tests