Fix authentication checking