fixing bug
some bugs worked out