fix the removing space function