Fix handling of spaces