Bug fixes for sanitizer, closes #6