Bug fixes and changes for new version

Bug fixes and changes for new version