fix more bugs in the function 'parts', add doctests