scripts: fix logic error in memorytrace.py