And your code really looks like this?
This should work fine. But here another option i usually use to prevent the Player from taking several items with one click when they overlap. I store the UID of the targeted object and compare it. That may look like this:
btw - i uploaded a jpg and a png file and both worked.