Various fixes for ARM build. Weird how only sync writing of one byte fails on ARM Linux.