Fixed tests and logging