MAINT: fix a bug but this is untested