delete unused imports
minor fixes. add more foolproof oib check.