fixed code prevent from firing while invisible