copied old code for publish