fixed small bug for logging and added unit tests for them