Fix C2664, C2027, C2227 errors