Publish not working as expected