bug fix and improved logging