some overflow fixes