#291, #291: Fix sync rules issue when syncing entities

The mapping of entities was bugged preventing a proper application of
sync rules
Minor logic optimization to decide a "blank" field
Minor code optimization