move _shutdown above spawn