Fixed some bugs

fixed bugs