minor refactoring on flexible hash conversion