remove duplication, and fix two reflection warnings