ugly login loop fix, more comments and logs