checkBalance function