fix a few obvious bugs