add task2 selftest and fix some bugs