possible fix for entity dupe bug, and did some build-fixing