making it work with pyinstaller, fixing bugs