added tests and fixed log