Fixed some bugs
fixing some bugs