added defined() checks to loader