fixed up some pop code