minor fixes, more offloading to c