fixed duplicate code issue