[API] fix 500 error on first login.