Bugfixing, removing unused upgrade code