Fixes for entities and text piece parsing