Added GPLv2 license

* added GPLv2 license
* bug fixes
added GPLv2 license and some bug fixes