fixed stupid bug with incorrect goal state id, added stats writer