cleanup ErlRuntime implementation and add tests for crashes