Add extra checks to prevent errors.