fix bugs on balance checks