beremiz

efdefbad49eb
runtime: fix bugs introduced in previous commit, and refactor some code