fix bug and apply encoder to authentication model