Fixed a bug spotted by @mitar.