bug fix and style changes