Fix bug in command invocation and session opening

Change-Id: I1995d1627f0f7035842ee327c67add797e5e3c70
Signed-off-by: Mika Tammi <mikatammi@gmail.com>