Bug fix replace magicSpace
Reformat code