added non-trivial test case for isBalanced