fix bugs

more to be fixed