fix parser bug and add smallcheck tests