Fix a bug on computing size functions for pure python implementation.
Add a test case for a c implementation.