restore logging
improved debug logging