ENH: fix bug add better test