fixed two very important bugs