Fixed some bugs
More bug fixes