fixed the memory leak on package lookup errors (thanks for chansen for this)