fix some obvious bugs