Use different class creation method to avoid deprecation in 3.3.