login: fix device related bugs