Fixing some bugs + improving the testcase ...