A person ordered held in custody following a preliminary examination shall not be discharged on a writ of habeas corpus or by other process because of any informality or error in the commitment or the proceedings prior thereto that does not substantially prejudice him. No preliminary examination shall be held invalid for any purpose because of an informality or error that does not substantially prejudice the defendant.