fix blank spaces bug of ref by trim