updated checkAccess to be more robust