many bug fixes

Community Data Science Collective || Want to submit a patch?