Cast to the proper type.