ENH: fixing some bugs