fixed replace_letters method