Fixed some auth logic