Fixed bugs in structure making