Improved enforcing of type restrictions.