Fixed tests and script on windows

It seems all fine now, but please check it on *nix system. :)