Implement reset functions (fixes #498)