improved debug loggin