update and fix problems in controller, add closesession method