Update auth module and fix some bugs