Fixed bad com_dedicated hackery in SP and added proper shutdown in case of error.