fixt a few bugs