Cast to right cnxn type