Bugfixes + upgrade script addition