close #21 and close #27, fixed shutdown stuff.
Merge remote-tracking branch 'upstream/master'