updated save and post button logic