remove the tail spaces