Added safety checks on getting/unregistering block IDs