Fixed tests and minor changes