bug fix for cases when switchElement method is used