Improved the performance of the authentication check