Move the resource loading to module level and fix logic of extentions