Fixed file.Write error.
Better debugging.