runtime: misc fixes and tweaks