fix resetting on slaves
merge with upstream