If it appears by the testimony offered with the return, or upon the hearing that the party is probably guilty of a criminal offense, the court, although the commitment is irregular, shall immediately remand the party to the custody of the proper person.