Fix trim trailing spaces issue