optionally replace spaces