minor refactoring to avoid compatibility problems