Minor bugfix in text optimizer