Fix overflow problems.