Modify autorotate so it only writes on success