type adapter factory improvements, new tests