removing space before end bracket