Completed testcases and fixed some bugs, that were found because of the them