Fix issues associated with changing opacity dynamically