Fix bucket folding when bucket type is undefined