fixed truncate by explicitly truncating in sync() - the FS API doesn't do it by default