more cleanups, make sure length of boolean array slice is checked.