fixed bug: module insertion - still has logical errrors