The previous commit had bad logic - this fixes it.