[FIXED] some cross-platform compatibility added to script

In Windows $HOME may contain space char. so i fixed the bugs of $HOME having space in it