Bug fixes
Fixes to make sure when Loki's code fails mine will gracefully fail.