add big unit test
fixed two bugs