Metaclass and type fixes