Add unit switch m and km, fix update function