fixed most of the bugs
Fixed some bugs