change argument type for ref parameter in Product loop. Fix #604