remove useless elements