Added fsync on/off support thanks to franciscofranco