Bug fix and better code style.