Bug fix

* Fixed a bug that crashed the program on windows
* Improved program performance