bugfix and add logger