Fixed code requiring shell in wrong places