The why is probably to do with picking, when you call a function and refer to an object it does not necessarily refer to any previous objects picked before the function was called. So the spawned invisible sprite in the pin function is not the same invisible sprite referred to in the main function.