almost working, file wont save correctly