fix a minor flaw in allocation handling