improved diagnostic logging