Avoid some unnecessary check in is_ore function