Fixed crash bug in authentication