Make processing retval of run_section more robust and improve tests