fixed a bug on authentication