Debug mode "fixes" authentication issue - race condition?