add test and debug