added onConenct and onExit blocks in the shell element for better
control
added missing shell check onExit