fixed all obvious bugs