fixed parsing bug with entities