fix code duplication2