Fixed some important Bugs