Fix unknown entity error on merge (fixes #1618)