Fixed changedstate bug to validate if statement.