Fixed bug when switching between GUI/UI. Fixed bugs on Portfolio.findByCode(code).