fixed test and added debug logging