ENH: various fixes