various fixes, minor changes, cleanup