Merge pull request: several bug fixes and minor ui improvements.