Reliable media saving

Fixes #23.