Many bugs fixed with SAMDB and SAMLauncherAgent