tweak bp_to_hashref to be less sensitive to array context