interpreter.py: clean-ups and minor bugfixes