Fix size bug, add some tests