Cast to proper types