few bugfixes and added some extras to help upgrade on older systems