Fix return value of authenticate function