Bug fix and enhancement