added stub Fsync and better error handling