Fixed entity handling, closes #6