Fixed bug in WriteGraphFile