close #21 and close #27, fixed shutdown stuff.