fix extra space in some cases