Fixed problems with authentication