fixed bug in market; misc cleanup