Fixed auth checking