Removed error where totalExpenses is undefined in some cases