Use unregister_image(id) on unregister

Change-Id: I573a89ae8e59790e6e860ac2b58390497734d6a8
Fixes: bug #1237939
Merge "Use unregister_image(id) on unregister"