Fix bug in find packed object.

Fixes #2650 
@ussuri 
I will revisit the logic and refactor the code (#2656).