Fix overflow issues