Make sure needsmax actually works for replicasets.
Merged pull request #799
Make sure that with the code in this snippet, the log always gets saved.
Merged pull request #798