Use delete instead of setting to null. Fixes #505