unecessary activities is thrown away, bug fix if swith statement