Some overflow fixes in the binary functions