Do not sleep if a shutdown is requested
Dependency fix
Added first test