Added test for saving input files and fixed bug with saving