Fixing warnings and logic errors in SDK.