Better version of reply function (more robust)