fixed setActive function