fixing error in publish, also added publish tests