Improve shell checking