Fix a type instability issue in SOSFilter conversion and add asserts