Bug fix, minor improvements.