Fix artifact saving and loading

Fixes #357 and #860