Fix bug regarding logging
Fix bug 3