Fix a bug which caused creation of empty images (and volumes) to crash.

Fixes #995.