Fixed bugs in case.