avoid exec statements; they cause problems with Python 3
This small change replaces exec() calls by calls to ast.literal_eval().
I don't know why exactly, but Python 3 appears to forget newly created variables after returning from exec(), so the current approach does not work with Python 3.