use isIn() instead of ii
fix minor bugs