Fixing authentication; db is hanging