write returns result