FIX: Fix megsim

Hopefully addresses #519.