fix overflow issues