fixed issue with referencing objects that weren't loaded. brought in function to test if a variable is a function