solved memory leak and incorrect watershed name assignment