some misc fixes, cleanup