modified view_portfolio function to prevent error