fix compiler warn, and other changes