Fixing bug in test case logic, adding some logging