implemented save to and fixed nil issues