bug fixes for api, portfolios controller