Added extra if condition to test whether publisher is created