Modify autorotate so it only writes on success
Merge remote-tracking branch 'upstream/master'