Fixed various issues wrt testcases.