Fix NPE when destroying gate blocks.