fix logic to avoid loosing blanks & spaces