added prebublish script, fixed main