writeIfExists fixed highest invoke