made locate slightly more robust