The first time it happened, my code looked very similar to yours with the question mark. I got around it by making him wait for 2 seconds before looking for a beacon, that stopped him from finding the forest beacon before the new one was completed.