Review fixe and add send_error function