Fixing bug in publish method.