Fix logic error in shell manager