Make sure detect is only performed once on page load