Fixed Some Bugs

Fixed some bugs that arrived after the last commit.