added proper editing, doesn't crash on no file