fix ToS overflow