Fix type consistency with logical arrays and add test