fixed duplicate code errors