Add test for Scribble model. Fix some bugs at the same time.