Fixed several tests and 1 bug