Be more careful freeing memory in detail reader