added GPLv2 license and some bug fixes