fix bug when authenticate user