Fixing an issue with balance query