foo() now runs successfully, though using printf() crashes. TOOD: Investigate