Fixed Lua error when duping an E2 with compile errors

Thanks to shadowscion for reporting it.
Fixes #640