Fixed integer overflow problem