fixed issues with functions on clicking save