prevent duplicate ids
fix block management