add invariant check to getBalance method