fixed the overflow issue bit better