fixed the redundant code portion