Publish button not working properly