bug fix for state filtering