Trace x2

So i got this function for using inventory items in a game i’m working on that looks like this:
if (item is i){
trace (item)
for (r in receiver of quest item array){
calculates distances
if (player is near r and other conditions are met etc){
trace(use the item)
use the item, update the inventory
}else{
trace(drop the item)
function to drop the item, update inventory
}
}
}

The thing is this code is doing a double trace on the drop part if not near the receiver of the item.If in range i get one trace use and one drop.I have no idea why it is doing this. Any clues to why it runs the code twice?And how to fix this?
I took out all the functions that might cause a bug and left just the trace and it just traces twice.If near “use/drop”, if out of range “drop/drop”

Thanks!