Fix bug in external auth