more code to debug balance problem