Swap long when writing id