fixed entity removal
fixed some build issues