minor bug fix and performance increase