moved exception throwing after consuming the entity. related to and should fix #5