fixed the overflow issue - fixes #378