Fix to handle publish within function call #11