unpack return values before return when replacing