Minor bug fix, and other cosmetic changes