Added check for empty course instance
Fixes deprecated module context call