added check to only keep when valid_obs == 1