updating the publish command to be more robust