Fixed bug where spaces, parentheses, and square brackets would not be escaped correctly.