I tried the insertion ahead of both instances, with no improvement. In my case, I’m trying to integrate UAM with the multi-language plugin WPML, so the situation is complex. When going to example.org/restrictedpage Peter’s change to user-access-manager.php fixed the problem of redirecting to the front page (it now redirects to the page it’s supposed to according to the UAM settings).
But when going to example.org/fr/restrictedpage (the French translation of the restricted page) it’s still getting redirected to the front page. Note that the /fr/ means the request gets intercepted and processed by WPML to return the French translation of ‘restrictedpage’, which is why this gets complex.