Fixed some bugs while writing limit tests.