Fixed several Bugs