Fix trailing character bug.