Fix bug in find and getReference methods