use pickle instead of yaml, various improvements and fixes