Fixed some errors if context functionality called before initialized context