Fixed some bugs a