Bug fixes related to devmgr, cfg agent, RPC and a test

Change-Id: Ifb20f032104355ee93cfa574931cd899c3e82105