fix word spacing logic