fix reply function