write several datasets at once - and fix some bugs