Fixed invalid shutdown function #2