Fixed a bunch of syntax errors in engine.py