Better logging

Fixes some logging issues