minor bug fix and clean up