Fixed index out of bound error when ua's length is less than 4