Extended logger and fixed a bug