Although the commitment of the person detained may have been irregular, still, if the court or judge is satisfied, from the examination, that the person ought to be held to bail, or committed, either for the offense charged, or any other, the order shall be made accordingly.