Fix writing ints