Active shell is returned only if it is not disposed. Fixes #644